package com.saicmotor.livedata.viewModel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.MutableLiveData;

import com.saicmotor.livedata.bean.AccountBean;

/**
 * @Author xinxinzhang
 * @Date 2022/08/16
 **/
public class AccountModel extends AndroidViewModel {
    // 数据存在LiveData
    private MutableLiveData<AccountBean> account = new MutableLiveData<>();

    public AccountModel(@NonNull Application application) {
        super(application);
    }

    public void setAccount(String name, String phone, String blog){
        account.setValue(new AccountBean(name, phone, blog));
    }

    public MutableLiveData<AccountBean> getAccount(){
        return account;
    }

    // 销毁
    @Override
    protected void onCleared() {
        super.onCleared();
    }
}
